<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style>
        .v-enter {
            opacity: 0;
            transform: translateX(-400px);
        }
        
        .v-enter-active {
            transition: all 1s ease;
            background-color: lightblue;
        }

        .v-enter-to{
            opacity: 1;
            transform: translateX(0);
        }


        .v-leave {
            opacity: 1;
            transform: translateX(0);
        }

        .v-leave-active{
            transition: all 1s ease;
        }

        .v-leave-to{
            opacity: 0;
            transform: translateX(400px);
        }

    </style>

</head>

<body>
    <div id='app'>
        <button @click="flag=!flag">切换动画</button>
        <transition appear duration="3000">
            <div v-show="flag">啦啦啦德玛西亚</div>
        </transition>

        <transition appear>
            <div v-show="!flag">嘀嘀嘀</div>
        </transition>
    </div>
    <script>
        const vm = new Vue({
            el: '#app',
            data: {
                flag: true
            }
        })
    </script>
</body>

</html>